
package GameLogic;

import java.util.*;
import GameLogic.Temps.*;

/**
 *
 * @author RikuXan
 */
public class Temporaries
{
    private Vector<Temporary> tempos;

    public Temporaries()
    {
        tempos = new Vector<Temporary>();
    }
    public void clear()
    {
        tempos.clear();
    }

    public boolean hasFood()
    {
        if( tempos != null )
        {
            for( Temporary temp : tempos )
            {
                if( temp instanceof Food )
                    return true;
            }
        }
        return false;
    }

    public String returnTexture( int pos )
    {
        return tempos.elementAt(pos).returnTexture();
    }

    public boolean isFood(int position)
    {
        return tempos.elementAt(position) instanceof Food;
    }

    public void generateFood( int x , int y )
    {
        Random rnd = new Random();
        int type = rnd.nextInt( 1 );

        switch( type )
        {
            case 0:
                generateApple( x , y );
                break;
        }

    }

    public void generateApple( int x , int y )
    {
        tempos.add( new Apple( x , y ) );
    }

    public void removeElement( int nr )
    {
        tempos.remove(tempos.elementAt(nr));
    }

    public int getLength()
    {
        return tempos.size();
    }

    public int getPosX(int nr)
    {
        return tempos.elementAt(nr).getPosX();
    }

    public int getPosY(int nr)
    {
        return tempos.elementAt(nr).getPosY();
    }




}
